class Solution:
    def stoneGameVI(self, aliceValues: list, bobValues: list) -> int:
        n = len(aliceValues)
        stones = [i for i in range(n)]
        stones.sort(key=lambda i: aliceValues[i] + bobValues[i], reverse=True)
        a = 0
        b = 0
        for i in range(len(stones)):
            stone = stones[i]
            if i % 2 == 0:
                a += aliceValues[stone]
            else:
                b += bobValues[stone]

        if a > b:
            return 1
        elif a < b:
            return -1
        else:
            return 0
